﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using System.IO;
using Commander.Classes;

namespace Commander.Views
{
    /// <summary>
    /// Логика взаимодействия для Remove.xaml
    /// </summary>
    public partial class Remove : Window
    {
        private string NameObj;
        private string Patch;
        private int tmp;
        public Remove()
        {
            InitializeComponent();
        }

        public void SetName(string patch,string name,int a)
        {
            Patch = patch;
            NameObj = name;
            tmp = a;
        }

        //1111
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (tmp == 1)
            {
                textBox1.Text = NameObj.Substring(0, NameObj.Length - 1);
            }
            else
            {
                textBox1.Text = NameObj;
            }
            //Keyboard.Focus(textBox1);
            
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Directory.Move(Patch + @"\" + NameObj, Patch + @"\" + textBox1.Text);
            this.Close();
        }
    }
}
